<?php
/**
 * this Dig_Application_Resource_Cache application resource
 * manages the cache
 *
 */
class Dig_Resource_Autoloader extends Zend_Application_Resource_ResourceAbstract
{
    public function init ()
    {
        $this->getBootstrap()->bootstrap('frontController');
        $this->_front = $this->getBootstrap()->getResource('frontController');
        $modules = $this->_front->getControllerDirectory();
        $autoLoader = Zend_Loader_Autoloader::getInstance();

        foreach ($modules as $module => $path) {
            if($module != 'default') {
            $resourceLoader = new Zend_Loader_Autoloader_Resource(array(
                'basePath' => $path . '/../',
                'namespace' => ucfirst($module) ,
                'resourceTypes' => array(
                    // in digitalus each module can have its own library
                    'library' => array('path' => 'library/' , 'namespace' => 'Library_')
                    ))
                );
            }
        }

        return $autoLoader;
    }
}
?>